package com.shop.cereshop.agent.param.wallet;

import com.shop.cereshop.commons.config.RsaProperties;
import com.shop.cereshop.commons.utils.RsaUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @description: TODO
 * @author lx
 * @date 2025/11/18 17:03
 * @version 1.0
 */
@Data
@ApiModel(value = "钱包支付参数")
@Slf4j
public class WalletPayDTO {
    @ApiModelProperty(value = "支付密码(需要加密)")
    private String payPassword;

    public WalletPayDTO decrypt() throws Exception {
        WalletPayDTO res = this;
        try {
            res.setPayPassword(RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, this.payPassword));
        } catch (Exception e) {
            log.error("解密失败");
        }
        return res;
    }
}
